home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Graphics Programming (2nd Edition) / Visual Basic Graphics Programming 2nd Edition.iso / Src / Ch1 / ImagePic.frm (.txt) < prev    next >
Visual Basic Form  |  1999-03-19  |  3KB  |  101 lines

  1. VERSION 5.00
  2. Begin VB.Form frmImagePic 
  3.    Caption         =   "ImagePic"
  4.    ClientHeight    =   3630
  5.    ClientLeft      =   1605
  6.    ClientTop       =   1140
  7.    ClientWidth     =   6150
  8.    LinkTopic       =   "Form1"
  9.    PaletteMode     =   1  'UseZOrder
  10.    ScaleHeight     =   3630
  11.    ScaleWidth      =   6150
  12.    Begin VB.CommandButton CmdClear 
  13.       Caption         =   "Clear"
  14.       Height          =   495
  15.       Index           =   1
  16.       Left            =   4200
  17.       TabIndex        =   4
  18.       Top             =   3120
  19.       Width           =   855
  20.    End
  21.    Begin VB.CommandButton CmdClear 
  22.       Caption         =   "Clear"
  23.       Height          =   495
  24.       Index           =   0
  25.       Left            =   1080
  26.       TabIndex        =   3
  27.       Top             =   3120
  28.       Width           =   855
  29.    End
  30.    Begin VB.CommandButton CmdCopy 
  31.       Caption         =   "Copy ==>"
  32.       Height          =   495
  33.       Left            =   2640
  34.       TabIndex        =   2
  35.       Top             =   3120
  36.       Width           =   855
  37.    End
  38.    Begin VB.PictureBox picScribble 
  39.       Height          =   3015
  40.       Index           =   1
  41.       Left            =   3120
  42.       ScaleHeight     =   2955
  43.       ScaleWidth      =   2955
  44.       TabIndex        =   1
  45.       Top             =   0
  46.       Width           =   3015
  47.    End
  48.    Begin VB.PictureBox picScribble 
  49.       AutoRedraw      =   -1  'True
  50.       Height          =   3015
  51.       Index           =   0
  52.       Left            =   0
  53.       ScaleHeight     =   2955
  54.       ScaleWidth      =   2955
  55.       TabIndex        =   0
  56.       Top             =   0
  57.       Width           =   3015
  58.    End
  59. Attribute VB_Name = "frmImagePic"
  60. Attribute VB_GlobalNameSpace = False
  61. Attribute VB_Creatable = False
  62. Attribute VB_PredeclaredId = True
  63. Attribute VB_Exposed = False
  64. Option Explicit
  65. Private DrawingIndex As Integer
  66. Private LastX As Single
  67. Private LastY As Single
  68. ' Clear the corresponding picture.
  69. Private Sub CmdClear_Click(Index As Integer)
  70.     picScribble(Index).Cls
  71. End Sub
  72. ' Copy picScribble(0)'s current display to
  73. ' picScribble(1)'s permanent background.
  74. Private Sub CmdCopy_Click()
  75.     picScribble(1).Picture = picScribble(0).Image
  76. End Sub
  77. Private Sub mnuFileExit_Click()
  78.     Unload Me
  79. End Sub
  80. Private Sub Form_Load()
  81.     DrawingIndex = -1
  82. End Sub
  83. Private Sub picScribble_MouseDown(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
  84.     DrawingIndex = Index
  85.     picScribble(Index).CurrentX = X
  86.     picScribble(Index).CurrentY = Y
  87.     LastX = X
  88.     LastY = Y
  89. End Sub
  90. Private Sub picScribble_MouseMove(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
  91.     If DrawingIndex <> Index Then Exit Sub
  92.     picScribble(Index).Line -(X, Y)
  93.     LastX = X
  94.     LastY = Y
  95. End Sub
  96. Private Sub picScribble_MouseUp(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
  97.     If DrawingIndex <> Index Then Exit Sub
  98.     DrawingIndex = -1
  99.     picScribble(Index).Line -(X, Y)
  100. End Sub
  101.